home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / PowerD / powerd / source / lib / powerd_lib.lha / PowerD_PPC / RealEStr.ass < prev    next >
Text File  |  2002-03-17  |  4KB  |  227 lines

  1.     .text
  2.     .sdreg    r2
  3.     .align    2
  4.     .global    _RealEStr
  5. _RealEStr:
  6. ###############################################################################
  7. # name           offset
  8. # __local        0
  9. # buf            8
  10. # neg            32
  11. # rest           36
  12. # top            40
  13. # d              44
  14. # args ###########################
  15. # str            52
  16. # f              56
  17. # n              64
  18.     mflr    r0
  19.     stw    r0,8(r1)
  20.     stwu    r1,-96(r1)
  21.     stw    r13,24(r1)
  22.     mr    r13,r1
  23.     stw    r3,52+28(r13)
  24.     stfd    f1,56+28(r13)
  25.     stw    r4,64+28(r13)
  26.     lis    r0,24
  27.     stw    r0,4+28(r13)
  28.     stb    r0,8+28(r13)
  29.     lwz    r0,RealEStr_laddr(r2)
  30.     stw    r0,0+28(r13)
  31. #     DEFL    top,rest,neg=FALSE
  32.     li    r3,0
  33.     stw    r3,32+28(r13)
  34. #     IF f<0 THEN neg:=TRUE
  35. if0:
  36.     lfd    f1,56+28(r13)
  37.     lfd    f2,n0(r2)
  38.     fcmpo    0,f1,f2
  39.     blt    $+12
  40.     li    r3,0
  41.     b    $+8
  42.     li    r3,-1
  43.     mr.    r3,r3
  44.     beq    end0
  45. #     IF f<0 THEN neg:=TRUE
  46.     li    r3,-1
  47.     stw    r3,32+28(r13)
  48. end0:
  49. #     d:=FAbs(f)
  50.     lfd    f1,56+28(r13)
  51.     fabs    f1,f1    # FAbs
  52.     stfd    f1,44+28(r13)
  53. #     top:=d
  54.     lfd    f0,44+28(r13)
  55.     fctiw    f0,f0
  56.     stfd    f0,-8(r1)
  57.     lwz    r3,-4(r1)
  58.     stw    r3,40+28(r13)
  59. #     d-=top
  60.     lfd    f1,44+28(r13)
  61.     lwz    r3,40+28(r13)
  62.     lis    r0,17200
  63.     stw    r0,-8(r1)
  64.     xoris    r0,r3,0x8000
  65.     stw    r0,-4(r1)
  66.     lfd    f0,-8(r1)
  67.     lfd    f2,conv(r2)
  68.     fsub    f2,f0,f2
  69.     fsub    f1,f1,f2
  70.     stfd    f1,44+28(r13)
  71. #         top--
  72. if2:
  73.     lfd    f1,44+28(r13)
  74.     lfd    f2,n1(r2)
  75.     fcmpo    0,f1,f2
  76.     blt    $+12
  77.     li    r3,0
  78.     b    $+8
  79.     li    r3,-1
  80.     mr.    r3,r3
  81.     beq    end2
  82. #         top--
  83.     lwz    r3,40+28(r13)
  84.     subi    r3,r3,1
  85.     stw    r3,40+28(r13)
  86. #         d++
  87.     lfd    f1,44+28(r13)
  88.     lfd    f2,n2(r2)
  89.     fadd    f1,f1,f2
  90.     stfd    f1,44+28(r13)
  91. end2:
  92. #     d*=1000000000
  93.     lfd    f1,44+28(r13)
  94.     lfd    f2,n3(r2)
  95.     fmul    f1,f1,f2
  96.     stfd    f1,44+28(r13)
  97. #     rest:=d
  98.     lfd    f0,44+28(r13)
  99.     fctiw    f0,f0
  100.     stfd    f0,-8(r1)
  101.     lwz    r3,-4(r1)
  102.     stw    r3,36+28(r13)
  103. #     IF f<0 THEN top:=-top
  104. if4:
  105.     lfd    f1,56+28(r13)
  106.     lfd    f2,n4(r2)
  107.     fcmpo    0,f1,f2
  108.     blt    $+12
  109.     li    r3,0
  110.     b    $+8
  111.     li    r3,-1
  112.     mr.    r3,r3
  113.     beq    end4
  114. #     IF f<0 THEN top:=-top
  115.     lwz    r3,40+28(r13)
  116.     neg    r3,r3
  117.     stw    r3,40+28(r13)
  118. end4:
  119. #     EStringF(buf,'\s\d.\z\r\d[9]',IF neg THEN '-' ELSE NIL,Abs(top),rest)
  120.     subi    r1,r1,12
  121.     addi    r3,r13,8+28
  122.     stw    r3,0+24(r1)
  123.     lwz    r3,@_str0(r2)
  124.     stw    r3,4+24(r1)
  125.     subi    r1,r1,12
  126. if6:
  127.     lwz    r0,32+28(r13)
  128.     mr.    r0,r0
  129.     beq    elseif6_1
  130.     lwz    r3,@_str1(r2)
  131.     stw    r3,0+24(r1)
  132.     b    end6
  133. elseif6_1:
  134.     li    r3,0
  135.     stw    r3,0+24(r1)
  136. end6:
  137.     lwz    r3,40+28(r13)
  138.     bl    _Abs    # Abs
  139.     stw    r3,4+24(r1)
  140.     lwz    r3,36+28(r13)
  141.     stw    r3,8+24(r1)
  142.     lwz    r3,0+28(r13)
  143.     addi    r3,r3,0
  144.     lwz    r4,0+24(r1)
  145.     stw    r4,0(r3)
  146.     lwz    r4,4+24(r1)
  147.     stw    r4,4(r3)
  148.     lwz    r4,8+24(r1)
  149.     stw    r4,8(r3)
  150.     addi    r1,r1,12
  151.     stw    r3,8+24(r1)
  152.     lwz    r3,24(r1)
  153.     addi    r1,r1,4
  154.     lwz    r4,24(r1)
  155.     addi    r1,r1,4
  156.     lwz    r5,24(r1)
  157.     addi    r1,r1,4
  158.     bl    _EStringF    # EStringF
  159. #     EStrCopy(str,buf,EStrLen(buf)-9+n)
  160.     lwz    r3,52+28(r13)
  161.     addi    r4,r13,8+28
  162.     stw    r4,20(r1)
  163.     stw    r3,16(r1)
  164.     subi    r1,r1,8
  165.     addi    r3,r13,8+28
  166.     lhz    r3,-2(r3)    # EStrLen
  167.     mr    r5,r3
  168.     lwz    r3,24(r1)
  169.     lwz    r4,28(r1)
  170.     addi    r1,r1,8
  171.     subi    r5,r5,9
  172.     lwz    r6,64+28(r13)
  173.     add    r5,r5,r6
  174.     bl    _EStrCopy    # EStrCopy
  175. RealEStrend:
  176.     lwz    r3,52+28(r13)
  177. RealEStrfinish:
  178.     lwz    r13,24(r1)
  179.     addi    r1,r1,96
  180.     lwz    r0,8(r1)
  181.     mtlr    r0
  182.     blr
  183.  
  184.     .global    _RealEStr
  185.     .type    _RealEStr,2
  186.     .size    _RealEStr,$-_RealEStr
  187. RealEStr_local:
  188. RealEStr_list0:
  189.     .ualong    0
  190.     .ualong    0
  191.     .ualong    0
  192.     .align    2
  193.     .global    _EStrCopy
  194.     .global    _EStringF
  195.     .global    _EStrLen
  196.     .global    _Abs
  197.     .global    _FAbs
  198.     .tocd
  199.     .global    RealEStr_laddr
  200. RealEStr_laddr:    .long    RealEStr_local
  201.     .extern    _stdrast_coloura
  202.     .extern    _stdrast
  203.     .extern    _exceptioninfo
  204.     .extern    _exception
  205.     .extern    _wbmessage
  206.     .extern    _PowerPCBase
  207.     .extern    _stdin
  208.     .extern    _stdout
  209.     .extern    _arg
  210.     .extern    _GfxBase
  211.     .extern    _IntuitionBase
  212.     .extern    _DOSBase
  213.     .extern    _ExecBase
  214.     .data
  215. n0:    .long    0x0       ,0x0       
  216.     .set    n1,n0
  217. n2:    .long    0x3FF00000,0x0       
  218. n3:    .long    0x41CDCD65,0x0       
  219.     .set    n4,n1
  220. conv:    .long    0x43300000,0x80000000
  221.     .extern    @_str0
  222.     .global    str0
  223. str0:    .byte    "%s%ld.%09.9ld",0
  224.     .extern    @_str1
  225.     .global    str1
  226. str1:    .byte    "-",0
  227.